// load content

function load_login()
{
	console.log('load');
	$('#content').load('/'+BASEPATH+'auth/login');
}

function load_register()
{
	console.log('load');
	$('#content').load('/'+BASEPATH+'auth/register');
}

function load_forgotPassword()
{
	console.log('load');
	$('#content').load('/'+BASEPATH+'auth/forgot_password');
}


/*
 * usefull functions
 */

function is_numeric(input){
    return typeof(input)=='number';
  }

/*
 *  Display alerts
 */
function display_alert(string, selector, kind)
{
        $(selector).html('<div class="alert alert-'+kind+' fade in" data-alert>'
        + '<strong>Message :</strong> ' + string
        + '</div>');
        $(".alert").alert();
        window.setTimeout(function() { $(".alert").alert('close').fadeOut('slow'); }, 2000);
}

// Adujst the height
function adjust_height(adjust)
{
	var totalHeight = $(document).height();
	$('#map').height(totalHeight - 40 - 50);//*/
}

// This is a functions that scrolls to #id
function scrollTo(id)
{
  // Scroll
  $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}


// Adujst the height
/*
function adjust_height(adjust)
{
	var topDivHeight = $("#header").height(),
	bottomDivHeight = $('#footer').height(),
	totalHeight = $(document).height();
	$('#main').height(totalHeight  - topDivHeight - bottomDivHeight - adjust);
	var mainDivHeight = $("#main").height();
}*/

function set_height(selector)
{/*
	var topDivHeight = $("#header").height(),
	bottomDivHeight = $('#footer').height(),
	main_headerDivHeight = $('#main_header').height(),
	totalHeight = $(document).height(),
	divHeight = totalHeight - topDivHeight - 170 - bottomDivHeight;
	$(selector).height(divHeight);
	$(selector).css("max-height:" + divHeight);*/
}

/*
 *  Switch interface
 */
function switchInterface(mode)
{
	if(mode == 'map')
	{
		if($('#map').hasClass('span4'))
		{
			$('#map').toggleClass('span8');
			$('#map').toggleClass('span4');	
		
			$('#content').toggleClass('span8');
			$('#content').toggleClass('span4');
		}
	}
	else if(mode == 'content')
	{
		if($('#content').hasClass('span4'))
		{
			$('#map').toggleClass('span8');
			$('#map').toggleClass('span4');
			
			$('#content').toggleClass('span8');
			$('#content').toggleClass('span4');	
		}
	}
	else
	{
		$('#content').toggleClass('span8');
		$('#content').toggleClass('span4');
		
		$('#map').toggleClass('span8');
		$('#map').toggleClass('span4');
	}
}